package org.lqq.serverRegisterAndFinder.serverFinder.eureka;

import com.netflix.appinfo.EurekaAccept;
import com.netflix.discovery.EurekaClientConfig;
import com.netflix.discovery.shared.transport.EurekaTransportConfig;

import java.util.ArrayList;
import java.util.List;

/**
 * Created by 李清泉 on 2017/10/26.
 *
 * @remark
 */
public class MyEurekaClientConfig implements EurekaClientConfig {
    @Override
    public int getRegistryFetchIntervalSeconds() {
        return 10;
    }

    @Override
    public int getInstanceInfoReplicationIntervalSeconds() {
        return 100;
    }

    @Override
    public int getInitialInstanceInfoReplicationIntervalSeconds() {
        return 10;
    }

    @Override
    public int getEurekaServiceUrlPollIntervalSeconds() {
        return 30;
    }

    @Override
    public String getProxyHost() {
        return null;
    }

    @Override
    public String getProxyPort() {
        return null;
    }

    @Override
    public String getProxyUserName() {
        return null;
    }

    @Override
    public String getProxyPassword() {
        return null;
    }

    @Override
    public boolean shouldGZipContent() {
        return false;
    }

    @Override
    public int getEurekaServerReadTimeoutSeconds() {
        return 3;
    }

    @Override
    public int getEurekaServerConnectTimeoutSeconds() {
        return 4;
    }

    @Override
    public String getBackupRegistryImpl() {
        return null;
    }

    @Override
    public int getEurekaServerTotalConnections() {
        return 10;
    }

    @Override
    public int getEurekaServerTotalConnectionsPerHost() {
        return 10;
    }

    @Override
    public String getEurekaServerURLContext() {
        return null;
    }

    @Override
    public String getEurekaServerPort() {
        return null;
    }

    @Override
    public String getEurekaServerDNSName() {
        return null;
    }

    @Override
    public boolean shouldUseDnsForFetchingServiceUrls() {
        return false;
    }

    @Override
    public boolean shouldRegisterWithEureka() {
        return true;
    }

    @Override
    public boolean shouldPreferSameZoneEureka() {
        return true;
    }

    @Override
    public boolean allowRedirects() {
        return false;
    }

    @Override
    public boolean shouldLogDeltaDiff() {
        return false;
    }

    @Override
    public boolean shouldDisableDelta() {
        return false;
    }

    @Override
    public String fetchRegistryForRemoteRegions() {
        return null;
    }

    @Override
    public String getRegion() {
        return "default";
    }

    @Override
    public String[] getAvailabilityZones(String region) {
        return new String[]{"defaultZone"};
    }

    @Override
    public List<String> getEurekaServerServiceUrls(String myZone) {
        List<String> list=new ArrayList<>();
        list.add("http://127.0.0.1:8084/eureka");
        return list;
    }

    @Override
    public boolean shouldFilterOnlyUpInstances() {
        return true;
    }

    @Override
    public int getEurekaConnectionIdleTimeoutSeconds() {
        return 3;
    }

    @Override
    public boolean shouldFetchRegistry() {
        return true;
    }


    @Override
    public String getRegistryRefreshSingleVipAddress() {
        return null;
    }

    @Override
    public int getHeartbeatExecutorThreadPoolSize() {
        return 5;
    }

    @Override
    public int getHeartbeatExecutorExponentialBackOffBound() {
        return 10;
    }

    @Override
    public int getCacheRefreshExecutorThreadPoolSize() {
        return 5;
    }

    @Override
    public int getCacheRefreshExecutorExponentialBackOffBound() {
        return 10;
    }

    @Override
    public String getDollarReplacement() {
        return "_-";
    }

    @Override
    public String getEscapeCharReplacement() {
        return "__";
    }

    @Override
    public boolean shouldOnDemandUpdateStatusChange() {
        return true;
    }

    @Override
    public String getEncoderName() {
        return null;
    }

    @Override
    public String getDecoderName() {
        return null;
    }

    @Override
    public String getClientDataAccept() {
        return EurekaAccept.full.name();
    }

    @Override
    public String getExperimental(String name) {
        return null;
    }

    @Override
    public EurekaTransportConfig getTransportConfig() {
        return new MyEurekaTransportConfig();
    }
}
